package gameManager;

import java.util.List;

public abstract class WeaponObject {

    private int cooldownTime;
    private int myWeaponLevel;
    private String myWeaponName;
    private int timeUntilNextFire;
    private int triggerTimeFromLastFired;
    private AmmunitionObject weaponAmmunition;
    
    
    public WeaponObject (int weaponLevel, int cooldownTime) {
        setWeaponLevel(weaponLevel);
        setCooldownTime(cooldownTime);  
    }

    public void setWeaponName (String newWeaponName) {
        myWeaponName = newWeaponName;
    }
    
    public String getWeaponName() {
        return myWeaponName;
    }
    public int getWeaponLevel() {
        return myWeaponLevel;
    }
    public void setWeaponLevel(int newWeaponLevel) {
        myWeaponLevel = newWeaponLevel;
    }

    public void changeWeaponLevel (int dWeaponLevel) {
        myWeaponLevel += dWeaponLevel;
    }

    public int getCooldownTime() {
        return cooldownTime;
    }

    public void setCooldownTime(int newCoolDownTime) {
        cooldownTime = newCoolDownTime;
    }

    public void changeCoolDownTime(int dCoolDownTime) {
        cooldownTime += dCoolDownTime;
    }
    
    public void updateCoolDownWaitingTime(int trigger) {

        timeUntilNextFire = cooldownTime + triggerTimeFromLastFired - trigger;
        if (timeUntilNextFire < 0) {
            timeUntilNextFire = 0;
        }
    }
    
    public AmmunitionObject getWeaponAmmunition() {
        return weaponAmmunition;
    }

    public abstract List<AmmunitionObject> fire(int trigger);
}
